/*
 * JLista.java
 *
 * Created on 16/06/2010, 14:39:00
 */
package com.playlist;

import com.musica.MusicaS;
import java.awt.Color;

/**
 *
 * @author Rudieri T. Colbek
 */
public class JLista extends javax.swing.JPanel {

    /**
     * Creates new form JLista <br/>Sendo que os valores para nome, artista e
     * tempo do Construtor {@link JLista#JLista(java.lang.String, java.lang.String, java.lang.String)}
     * são inicializados com null.
     */
    public JLista() {
        this(null, null, null);
    }

    /**
     * Creates new form JLista
     *
     * @param nome O texto que irá aparecer no label do nome
     * @param artista O texto que irá aparecer no label do artista
     * @param tempo O texto que irá aparecer no label do tempo
     */
    public JLista(String nome, String artista, String tempo) {


        initComponents();
        jLabelNome.setText(nome);
        jLabelArtista.setText(artista);
        jLabelTempo.setText(tempo);


    }

    public void setMusica(MusicaS musica) {
        jLabelNome.setText(musica.getNome());
        jLabelArtista.setText(musica.getAlbum() == null ? "" : musica.getAlbum().getAutor() == null ? "" :musica.getAlbum().getAutor().getNome());
        jLabelTempo.setText(musica.getTempo().toString());
    }

    @Override
    public void setForeground(Color fg) {
        super.setForeground(fg);
        if (jLabelArtista != null && jLabelNome != null && jLabelTempo != null) {
            jLabelArtista.setForeground(fg);
            jLabelNome.setForeground(fg);
            jLabelTempo.setForeground(fg);

        }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabelNome = new javax.swing.JLabel();
        jLabelTempo = new javax.swing.JLabel();
        jLabelArtista = new javax.swing.JLabel();

        setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED), javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED, java.awt.Color.darkGray, java.awt.Color.darkGray, java.awt.Color.black, java.awt.Color.black)));
        setLayout(new java.awt.GridLayout(2, 0));

        jPanel1.setOpaque(false);
        jPanel1.setLayout(new java.awt.BorderLayout());

        jLabelNome.setFont(new java.awt.Font("Dialog", 1, 11)); // NOI18N
        jLabelNome.setForeground(new java.awt.Color(49, 45, 31));
        jLabelNome.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabelNome.setText("Nome da musica (se não tiver, aparece o nome do arquivo)");
        jPanel1.add(jLabelNome, java.awt.BorderLayout.CENTER);

        jLabelTempo.setFont(new java.awt.Font("Dialog", 0, 11)); // NOI18N
        jLabelTempo.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabelTempo.setText("00:00:00");
        jLabelTempo.setPreferredSize(new java.awt.Dimension(55, 16));
        jPanel1.add(jLabelTempo, java.awt.BorderLayout.EAST);

        add(jPanel1);

        jLabelArtista.setFont(new java.awt.Font("Dialog", 0, 11)); // NOI18N
        jLabelArtista.setText("Artista que fez ou gravou a musica XD");
        add(jLabelArtista);
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabelArtista;
    private javax.swing.JLabel jLabelNome;
    private javax.swing.JLabel jLabelTempo;
    private javax.swing.JPanel jPanel1;
    // End of variables declaration//GEN-END:variables
}
